# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-ipparser
pkgname=('python2-ipparser' 'python-ipparser')
_pkgname=ipparser
pkgver=1.0.2
_pyver=3.13
pkgrel=3
pkgdesc='Parse IP address information and return a list for iteration.'
arch=('any')
url='https://pypi.org/project/ipparser/#files'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('623833c0475df218a00ce94f016353fe580a1ddeeed98f114160a02171600d4adc43a118c6881b7932b16869bdbb5c58dd0081efcd15de96799baf956e2cbfab')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-ipparser() {
  depends=('python2' 'python2-dnspython')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build

  chmod 644 \
    "$pkgdir/usr/lib/python2.7/site-packages/$_pkgname-$pkgver-py2.7.egg-info/"*
}

package_python-ipparser() {
  depends=('python' 'python-dnspython')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build

  chmod 644 \
    "$pkgdir/usr/lib/python$_pyver/site-packages/$_pkgname-$pkgver-py$_pyver.egg-info/"*
}

